select distinct rtrim(e_mail) e_mail into #1
from pos_vip_info 
where charindex('@', e_mail) > 0  
 
select identity(int, 1,1) seq, rtrim(e_mail) e_mail into #a from #1
select * from #a
set nocount on
declare @strmail nvarchar(4000),  @i int 
select @strmail = '', @i = 1

while (@i<2100)
begin
	select  @strmail = @strmail + ';'+ rtrim(e_mail) 
	from #a 
	where charindex('@', e_mail) > 0  and seq between @i and @i+150-1
	select @strmail
	select @i = @i+150
end
/*
1 and 150
151 and 300 
301 and 450 
451 and 600
601 and 750
751 and 900
901 and 1050
1051 and 1200 
1201 and 1350
1351 and 1500
1501 and 1650
1651 and 1800
1801 and 1950
1951 and 2100
*/

